/**************************************************************************//**
 * @file    Helpers.h
 * @author  İsmail SEZEN (email: sezenismail@gmail.com)
 * @date    02-08-2009
 *
 * @note This is part of siklon project. (Siklon.c)
 *
 * <b>Description</b>
 *
 * This is header file of Helpers.c\n
 *
 * Copyright (C) 2009 İsmail SEZEN
 *
 * <b>License</b>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *****************************************************************************/

struct cyclone_item;

/*Macros*///{
/*! @brief Unpacks a grid point value in the NC file according to \ref scaleFactor and \ref addOffset
 *  @f[ result = (unpackedValue * scaleFactor) + addOffset @f] */
#define UNPACK(val) ((val) * info.attr.hgt.scaleFactor) + info.attr.hgt.addOffset
/*! @brief Converts degree latitude to grid index value\n\n
 *  <b>lat</b> is spherical latitude value in Degree\n
 *  <b>d</b> is distances between two index ( i.e. 2.5 degree ) */
#define LAT_TO_IND(lat,d) ((90.0f - lat)/d)
/*! @brief Converts latitude index to real mathematical coordinates value */
#define IND_TO_LAT(i) (dom.dims.lats[i])
/*! @brief Converts degree longtitude to grid index value\n\n
 *  <b>lon</b> is spherical longtitude value in Degree\n
 *  <b>d</b> is distances between two index ( i.e. 2.5 degree ) */
#define LON_TO_IND(lon,d) ((lon)/(d))
/*! @brief Converts longtitude index to real mathematical coordinates value */
#define IND_TO_LON(i) (dom.dims.lons[i])
//}

extern short*** createDataArray(int level_count, int lat_count, int lon_count);
extern int hgt_is_min(short *h);
extern int hgt_find_real_min_location(short *h, float scaleFactor, float addOffset ,  double *x_loc, double *y_loc, double *val);
extern double Haversine_Distance(double lat1,double lon1, double lat2, double lon2);
